/**
 * 
 */
package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import partitioner.DataAccessException;

/**
 * @author puneet
 * 
 */
public class DBUtil {
	public static Connection getConnection()throws DataAccessException {
		try {
			Class.forName("com.mysql.jdbc.Driver");
			return DriverManager.getConnection("jdbc:mysql://localhost/graphpartitions","root","ubersecurity");
		} catch (Exception e) {
			throw new DataAccessException(e);
		}
	}
	
	public static void closeConnection(Connection conn) {
		if(conn != null) {
			try {
				conn.close();
			} catch (SQLException e) {
				System.err.println("Exception while closing connection");
				e.printStackTrace();
			}
		}
	}
}
